@REM 对 hex 文件添加版本信息
@echo off

SETLOCAL
set input_file=%~1


@REM 根据文件配置信息对 hex 文件转 Bin 文件
call %g_bat_dir_path%\readini.bat %g_config_file_path% option isGenerateBin isGenerateBin
call %g_bat_dir_path%\readini.bat %g_config_file_path% file hexFileAddr hexFileAddr

@if not defined isGenerateBin (
	@echo Warning: .ini file [option: isGenerateBin] does not set param
	exit /B 0
)

@if not defined hexFileAddr (
	@echo Error: .ini file [file: hexFileAddr] does not set param
	exit /B 1
)

@if %isGenerateBin% equ 1 (
	%g_exe_dir_path%\srec_cat.exe %g_obj_dir_path%\%input_file%.hex -intel -offset -%hexFileAddr% -o %g_obj_dir_path%\%input_file%.bin -binary
)

ENDLOCAL
exit /B 0